import request from "../utils/request";
import ins from "../utils/ins";
import { DataType } from "../views/user/UserList";
export interface IAdminParams {
  adminname: string
  password: string
}

export function adminLoginFn (params: IAdminParams) {
  return request({
    url: '/admin/login',
    method: 'POST',
    data: params
  })
}

export function getUserList() {
    return ins({
        url: 'http://localhost:12580/user'
    })
}

export function delUserList(id:number) {
    return ins({
        url: 'http://localhost:12580/user/' + id,
        method: 'delete'
    })
}

export function addUser(data:DataType) {
  return ins({
    url: 'http://localhost:12580/user',
    method: 'post',
    data
  })
}